﻿namespace HiMap.Geometry
{
    using System;

    public class EnvelopeClass : GeometryClass, IEnvelope, IGeometry
    {
        protected internal double _MaxX;
        protected internal double _MaxY;
        protected internal double _MinX;
        protected internal double _MinY;

        public EnvelopeClass()
        {
            base._Type = GeometryType.Envelope;
            this._MinX = 0;
            this._MaxX = 0;
            this._MinY = 0;
            this._MaxY = 0;
            base._Envelope = this;
        }

        IPoint IEnvelope.CenterAt
        {
            get
            {
                IPoint point = new PointClass();
                point.X = (this._MaxX + this._MinX) / 2;
                point.Y = (this._MaxY + this._MinY) / 2;
                return point;
            }
        }

        double IEnvelope.MaxX
        {
            get
            {
                return this._MaxX;
            }
            set
            {
                this._MaxX = value;
            }
        }

        double IEnvelope.MaxY
        {
            get
            {
                return this._MaxY;
            }
            set
            {
                this._MaxY = value;
            }
        }

        double IEnvelope.MinX
        {
            get
            {
                return this._MinX;
            }
            set
            {
                this._MinX = value;
            }
        }

        double IEnvelope.MinY
        {
            get
            {
                return this._MinY;
            }
            set
            {
                this._MinY = value;
            }
        }

        IEnvelope IGeometry.Envlope
        {
            get
            {
                IEnvelope envelope = new EnvelopeClass();
                envelope.MinX = this._MinX;
                envelope.MaxX = this._MaxX;
                envelope.MinY = this._MinY;
                envelope.MaxY = this._MaxY;
                return envelope;
            }
        }
    }
}

